home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Extravaganza - Disc 4
/
Shareware Extravaganza - Over 25,000 Programs (The Ultimate Shareware Company)(Disc 4 of 4)(1993).iso
/
cad
/
cmenu13.zip
/
CMENU.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1990-08-26
|
4KB
|
146 lines
; Custom#Menu (c) 1990 Mountain Software
; 8/26/90 version 1.3
(princ "\nLoading CMenu...")
;------
Initialize variables
;------
(setq _typ "Command"
_lstyp _typ
_lblk nil
_ttl ""
_cmd ""
)
;------
; Block insert routine
;------
(defun doinsert (/ _blk blkrec lstrec s)
(if (null _lblk) (progn
(setq blkrec (tblnext "BLOCK" T) ;retrieve first block
lstrec blkrec)
(while (boundp 'blkrec)
(setq blkrec (tblnext "BLOCK"))
(if (boundp 'blkrec) (setq lstrec blkrec))
)
(if (boundp 'lstrec) (setq _lblk (cdr (assoc 2 lstrec))))
))
(if (null _lblk) (progn
(initget 1)
(setq s "\nBlock name: ")
)
(progn
(setq s (strcat "\nBlock name[" _lblk "]:"))
(if (null s) (setq s _lblk))
))
(setq _blk (getstring s))
(if (not _blk) (setq _blk _lblk))
(if (boundp '_blk) (setq _cmd _blk) (setq _cmd nil))
)
;------
; Command input function
;------
(defun docommand ()
(princ "\nSpecial Menu Command Characters:")
(princ "\n^C^C = Cancel, ^P = Toggle menuecho, ; = Return, \\ = Pause for input")
(setq _cmd (getstring t "\nEnter menu command: "))
)
;------
; AutoLisp function
;------
(defun dolisp (/ al_fn al_cmd)
(setq al_fn (getstring "\nAutolisp filename: ")
al_cmd (getstring (strcat "\nAutolisp command to execute[" al_fn "]: ")))
(if (= al_cmd "") (setq al_cmd al_fn))
(if (= al_fn "") (setq _cmd al_cmd) ;else
(setq _cmd (strcat "^C^C^P(cond ((null c:" al_cmd ") (load \""
al_fn "\")) (t (princ))) " al_cmd " ^P"))
)
)
;------
; Write Parameter file
;------
(defun writedat (/ f)
(setq f (open "cmenu.dat" "w"))
(if (boundp 'f) (progn
(princ (strcat (getvar "MENUNAME") "\n") f)
(princ (strcat (getvar "DWGPREFIX") "\n") f)
(princ (strcat (getvar "ACADPREFIX") "\n") f)
(princ (strcat _ttl "\n") f)
(princ mode f) (princ "\n" f)
(princ item f) (princ "\n" f)
(princ (strcat insovr "\n") f)
(princ (strcat _typ "\n") f)
(princ (strcat _cmd "\n") f)
(close f)
) (princ "\nError opening CMENU.DAT"))
)
;------
; Main
;------
(defun c:cmenu (/ cecho trk done)
(setq cecho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(princ "\nCMenu initializing...")
(command "MENU" "")
(graphscr)
(princ "\n\n\nPick Tablet, Button or Screen Menu Location with cursor...")
(setq trk (grread)
mode (car trk)
item (cadr trk)
done nil
)
(cond ((= mode 4)
(if (< item 1000) (princ "\nScreen Menu selected ") ;else
(princ "\nPopUp Menu selected "))
)
((= mode 6) (princ "\nButtons selected "))
((= mode 7) (princ "\nTABLET1 selected "))
((= mode 8) (princ "\nTABLET2 selected "))
((= mode 9) (princ "\nTABLET3 selected "))
((= mode 10) (princ "\nTABLET4 selected "))
((= mode 11) (princ "\nAUX1 selected "))
((= mode 13) (princ "\nKeyboard Menu selected "))
(t (setq done t))
)
(if (not done) (progn
(if (and (>= mode 6) (<= mode 11)) (setq insovr "Overwrite") (progn ;else
(initget 0 "Add Insert Overwrite Delete")
(setq insovr (getkword (strcat "\nAdd/Insert/Overwrite/Delete[I]: ")))
(if (null insovr) (setq insovr "Insert"))
))
(if (/= insovr "Delete") (progn
(princ "\nSpecial Titles:\n ~-- = Horizontal line in PopUp, Blank title = Command used for title")
(setq _ttl (getstring t "\nEnter Menu Title: "))
(initget 0 "AutoLisp Insert Command")
(setq _lstyp _typ)
(setq _typ (getkword (strcat "\nAutoLisp/Insert block/Command[" _lstyp "]: ")))
(if (null _typ) (setq _typ _lstyp))
(if (= _typ "Insert") (doinsert)
(if (= _typ "AutoLisp") (dolisp)
(docommand)
)
)
))
(writedat)
(command "SHELL" "CMENU")
(setvar "CMDECHO" 1)
(command "MENU" "")
))
(setvar "CMDECHO" cecho)
(princ)
)
(princ "\nCMenu loaded - Enter \"CMENU\" to run") (princ)